package com.eulog.gwt.euloggwtlibrary.user.client.ui;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;

public class FlashWidget extends Composite {
	private HTML html;

    public FlashWidget(String url,final int pixelWidth, final int pixelHeight) {
        html = new HTML();
        initWidget(html);

        StringBuffer sb = new StringBuffer();
                       
        sb.append("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
        sb.append("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ");
        sb.append("WIDTH=\""+pixelWidth+"\" HEIGHT=\""+pixelHeight+"\" id=\""+url+"\" ALIGN=\"\"> ");
        sb.append("<PARAM NAME=movie VALUE=\""+url+"\">");
        sb.append("<PARAM NAME=quality VALUE=high>");
        sb.append("<PARAM NAME=LOOP VALUE=\"true\">");
        sb.append("<PARAM NAME=wmode VALUE=transparent>");
        sb.append("<EMBED src=\""+url+"\"");
        sb.append(" quality=high");
        sb.append(" wmode=\"transparent\"");
        sb.append(" WIDTH=\""+pixelWidth+"\"");
        sb.append(" HEIGHT=\""+pixelHeight+"\"");
        sb.append(" NAME=\"flashmovie/flashmovie.swf\"");
        sb.append(" ALIGN=\"\" ");
        sb.append("TYPE=\"application/x-shockwave-flash\" ");
        sb.append("PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED></OBJECT>");
        
        html.setHTML(sb.toString());

        setPixelSize(pixelWidth, pixelHeight);
        html.setPixelSize(pixelWidth, pixelHeight);
    }
}
